package com.ycw.servlet.guoguo;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.ycw.dao.LogisticsDao;
import com.ycw.dao.impl.LogisticsDaoImpl;

/**
 * Servlet implementation class DeleteLogisticsDataById
 */
@WebServlet("/deleteLogisticsDataByIdServlet")
public class DeleteLogisticsDataByIdServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 根据id删除
		String id = request.getParameter("l_id");
		Integer l_id = Integer.parseInt(id);

		LogisticsDao ld = LogisticsDaoImpl.getInstance();
		/**
		 * true删除成功
		 */
		boolean flage = ld.deleteLogisticsDataById(l_id);

		String resJSON = JSON.toJSONString(flage);
		PrintWriter out = response.getWriter();
		out.write(resJSON);

	}

}
